import type { MenuId, useContextMenu } from 'react-contexify';

type Icon = 'copy' | 'edit' | 'delete' | 'download';

interface Item {
  /** 图标 */
  icon: Icon;
  /** 菜单名 */
  name: string;
  /** 菜单点击 */
  onClick: () => void;
}

export interface Props {
  /** 菜单ID */
  id: MenuId;
  /** 菜单项 */
  items: Item[];
}

type UseContextMenu = ReturnType<typeof useContextMenu>;

export interface MenuRef {
  /** 显示菜单 */
  show: UseContextMenu['show'];
  /** 隐藏所有菜单 */
  hideAll: UseContextMenu['hideAll'];
}
